home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
SourceCode
/
Tutorial
/
Cookbook
/
25.Adder
/
AdderView.m
< prev
next >
Wrap
Text File
|
1995-06-12
|
978b
|
54 lines
/* Generated by Interface Builder */
#import "AdderView.h"
#import <appkit/Control.h>
#import <appkit/Form.h>
#import <dpsclient/wraps.h>
@implementation AdderView
- setSendOutput:anObject
{
sendOutput = anObject;
return self;
}
- input1:sender
{
in1 = [sender floatValue];
sum = in1 + in2;
[sendOutput setFloatValue:sum];
[self display];
return self;
}
- input2:sender
{
in2 = [sender floatValue];
sum = in1 + in2;
[sendOutput setFloatValue:sum];
[self display];
return self;
}
- drawSelf:(NXRect*)r :(int)c
{
NXEraseRect(&bounds);
PSsetgray(NX_BLACK);
PSnewpath();
PSsetlinewidth(in1*5.0);
PSmoveto(0.0, bounds.size.height/2.0);
PSlineto(bounds.size.width, bounds.size.height/2.0);
PSstroke();
PSnewpath();
PSsetlinewidth(in2*5.0);
PSmoveto(bounds.size.width/2.0, 0.0);
PSlineto(bounds.size.width/2.0, bounds.size.height);
PSstroke();
return self;
}
@end